import type { ApiRequest } from '@/types/apis.d'
import type { BackupsItem } from '@/types/backups/backups'
import { request } from '../index'
export interface BackupsRequest {
  //备份管理
  'backups.recycle_list': {
    offset: number
    limit: number
  }
  //备份管理
  'backups.table_list': {
    offset: number
    limit: number
  }
  //删除备份
  'backups.recycle_delete': {
    id: string
  }
  //批量删除备份
  'backups.recycle_batchDelete': {
    ids: string[]
  }
  //还原备份
  'backups.recycle_restore': {
    id: string
  }
  //创建备份
  'backups.recycle_create': {
    tables_name: string[] | undefined
    backups_name: string | undefined
  }
}
//数据恢复列表
export const recycle_list = (params?: ApiRequest['backups.recycle_list']) =>
  request.get<'backups.recycle_list', BackupsItem[]>('v1/backups/list', params)
//数据备份列表
export const table_list = (params?: ApiRequest['backups.table_list']) =>
  request.get<'backups.table_list', BackupsItem[]>('v1/backups/table/list', params)
//删除备份
export const recycle_delete = (data?: ApiRequest['backups.recycle_delete']) =>
  request.post<'backups.recycle_delete', any[]>('v1/backups/delete', data)
//批量删除备份
export const recycle_batchDelete = (data?: ApiRequest['backups.recycle_batchDelete']) =>
  request.post<'backups.recycle_batchDelete', any[]>('v1/backups/batch/delete', data)
//删除备份
export const recycle_restore = (data?: ApiRequest['backups.recycle_restore']) =>
  request.post<'backups.recycle_restore', any[]>('v1/backups/restore', data)
//创建备份
export const recycle_create = (data?: ApiRequest['backups.recycle_create']) =>
  request.post<'backups.recycle_create', any[]>('v1/backups/create', data)
